package com.fix.day3jdbc.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.fix.day3jdbc.dao.StudentDao;
import com.fix.day3jdbc.entity.Student;
import com.fix.day3jdbc.service.StudentService;

@Service
@Transactional
public class StudentServiceImpl implements StudentService {
	
	@Autowired
	StudentDao stuDao;

	public void zhuce() {
		
		Student st1 = new Student("强东", "男", "410");
		Student st2 = new Student("马东", "男", "120");
	
		stuDao.addStu(st1);
		stuDao.addStu(st2);

	}

	//某些方法不需要事务
	@Transactional(propagation =Propagation.NOT_SUPPORTED)
	public List<Student> getAll() {
		System.out.println("所有学生");
		return null;
	}

}
